package com.t216.hot216.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.t216.hot216.mapper.HotEventsMapper;
import com.t216.hot216.pojo.HotEvents;
import com.t216.hot216.service.HotEventsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class HotEventsServiceImpl  implements HotEventsService {
    @Resource
    private HotEventsMapper hotEventsMapper;
    @Override
    public PageInfo<HotEvents> getHotsByPage(String keyWord, int currentPage) {
        /*第一个参数:当前要显示的页码 第二个参数:每页显示多少条数据*/
        PageHelper.startPage(currentPage,5);

        List<HotEvents> list = hotEventsMapper.getHotsByPage(keyWord);

        PageInfo pageInfo = new PageInfo(list);

        return pageInfo;
    }
}
